from typing import Dict, List, Optional
import random


class Arena:
    def __init__(self, name: str, description: str = ""):
        self._name = name
        self._description = description
        self._effects = []
    
    @property
    def name(self) -> str:
        return self._name
    
    @property
    def description(self) -> str:
        return self._description
    
    def get_arena_effects(self) -> List[Dict]:
        return self._effects.copy()
    
    def apply_arena_effect(self, champion) -> Dict:
        return {"success": True, "message": f"{champion.name} is affected by {self.name}"}


class ChangAnArena(Arena):
    def __init__(self):
        super().__init__(
            name="Chang'An Arena",
            description="The grand arena in the heart of Chang'An city"
        )
        self._effects = [
            {"type": "spirit_boost", "description": "Ancient spirits boost all champions' mana by 10%"}
        ]


class DragonNestArena(Arena):
    def __init__(self):
        super().__init__(
            name="Dragon's Nest",
            description="A volcanic arena where dragons once nested"
        )
        self._effects = [
            {"type": "fire_damage", "description": "Occasional fire damage to all champions"},
            {"type": "fire_resistance", "description": "Fire-based abilities deal 20% more damage"}
        ]


class IcePalaceArena(Arena):
    def __init__(self):
        super().__init__(
            name="Ice Palace",
            description="A frozen palace of eternal winter"
        )
        self._effects = [
            {"type": "ice_slow", "description": "All champions move 15% slower"},
            {"type": "ice_immunity", "description": "Ice-based abilities have reduced effectiveness"}
        ]


class ThunderPeakArena(Arena):
    def __init__(self):
        super().__init__(
            name="Thunder Peak",
            description="A mountain peak where lightning strikes constantly"
        )
        self._effects = [
            {"type": "lightning_strike", "description": "Random lightning strikes during battle"},
            {"type": "electric_boost", "description": "Electric abilities have 25% chance to chain"}
        ]


class PhoenixGardenArena(Arena):
    def __init__(self):
        super().__init__(
            name="Phoenix Garden",
            description="A mystical garden where phoenixes once roamed"
        )
        self._effects = [
            {"type": "healing_aura", "description": "All champions regenerate 5 health per turn"},
            {"type": "rebirth_chance", "description": "10% chance to revive when killed"}
        ]
class ArenaManager:
    def __init__(self):
        self._arenas = {
            "Chang'An Arena": ChangAnArena(),
            "Dragon's Nest": DragonNestArena(),
            "Ice Palace": IcePalaceArena(),
            "Thunder Peak": ThunderPeakArena(),
            "Phoenix Garden": PhoenixGardenArena()
        }
    
    def get_available_arenas(self) -> List[str]:
        return list(self._arenas.keys())
    
    def get_arena(self, arena_name: str) -> Optional[Arena]:
        return self._arenas.get(arena_name)
    
    def get_arena_info(self, arena_name: str) -> Dict:
        arena = self.get_arena(arena_name)
        if not arena:
            return {}
        
        return {
            "name": arena.name,
            "description": arena.description,
            "effects": arena.get_arena_effects()
        }